package com.title2;

import java.io.*;
import java.util.HashSet;

/**
 * @Author milian
 * @Date 2021/8/3 0003 19:57
 */
public class title2 {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("H:\\homework\\homeWork\\src\\com\\day12\\title2\\a.txt"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("H:\\homework\\homeWork\\src\\com\\day12\\title2\\b.txt"));
        byte[] bytes = new byte[1024];
        int len;
        String s="";
        while ((len=bis.read(bytes))!=-1){
            s=s+new String(bytes,0,len);
        }
        String[] split = s.split("");
        HashSet<String> hashSet = new HashSet<>();
        for (String str:split
             ) {
            hashSet.add(str);
        }
        StringBuilder sb = new StringBuilder("");
        for (String s1 : hashSet) {
            sb.append(s1);
        }
       bos.write(sb.toString().getBytes());
        bis.close();
        bos.close();
    }
}
